var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("UIConfig"),
    c = t("UIManager"),
    p = t("GameEm"),
    l = t("AdView"),
    d = cc._decorator,
    u = d.ccclass,
    h =
        (d.property,
        d.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.canClick = !1;
                return e;
            }
            e.prototype.onShowEnd = function () {
                l.default.showAd(function () {
                    console.log("打开餐厅升级界面。展示广告");
                }, l.AdTypeEm.implant);
                EVUIEffView.on(EVUIEffView.checkCostUI, this.updateView.bind(this), this);
                this.updateView();
                QAudio.play(QAudio.ui_popup);
            };
            e.prototype.updateView = function () {
                var t = GameDataValue.getLastLv();
                t <= 0 && (this._mapBtn.active = !1);
                var e = t + 1,
                    o = CacheDataManager.getChapterRoomId(t),
                    a = CacheDataManager.getChapterRoomId(e),
                    i = CacheDataManager.getRestaurant(o, t),
                    n = CacheDataManager.getRestaurant(a, e);
                this._levelDetail.$Label.string = i.max_level + "级！";
                SpriteView.setTaskSprite(this._room1.$Sprite, i.icon);
                SpriteView.setTaskSprite(this._room2.$Sprite, n.icon);
                this._detail1.$Label.string = i.desc + "";
                this._detail2.$Label.string = n.desc + "";
                var r = this.getCost(i, 1),
                    s = ParseTool.parseAbc(r + "");
                this._costCount.$Label.string = s + "";
                var c = CacheDataManager.getCanUpLevel();
                this.canClick = CacheDataManager.checkCost(CacheDataManager.getCoinCount(), r + "") && c;
                for (var l = this._nextRoom.getComponentsInChildren(cc.RenderComponent), d = 0; d < l.length; d++)
                    CacheDataManager.setSpriteMat(l[d], this.canClick);
                this._lay1.active = c;
                this._lay2.active = !c;
                if (i.reward) {
                    var u = CacheDataManager.getRewardKind(i.reward);
                    SpriteView.setTaskSprite(this._boxSprite.$Sprite, u.icon);
                    var h = i.reward_num || 1;
                    this._boxCount.$Label.string = "×" + h;
                    this._rewardData.active = !0;
                    if (
                        !GuildCache.isOverOnceGuid(GuildCache.oncecheckId[1][1]) &&
                        CacheDataManager.getRedData(p.RedEm.gameTask)
                    ) {
                        GuildCache.checkKey = GuildCache.oncecheckId[1][1];
                        GuildCache.overOnceGuid(GuildCache.oncecheckId[1][1]);
                        GuildCache.openGuildView();
                    }
                } else this._rewardData.active = !1;
                if (t % 7 == 6) {
                    this._layView1.active = !1;
                    this._layView2.active = !0;
                    this._costCount.$Label.string = "新区域";
                    this._btnCoin.active = !1;
                } else {
                    this._layView1.active = !0;
                    this._layView2.active = !1;
                }
            };
            e.prototype.getCost = function (t, e) {
                void 0 === e && (e = 1);
                var o = t.up_cost;
                o = Math.floor(parseInt(o) * e) + "";
                for (var a = t.up_cost2, i = 0; i < a; i++) o += "0";
                return o;
            };
            e.prototype.onCloseStart = function () {
                EVUIEffView.offTarget(this);
            };
            e.prototype._onNextRoomTouchEnd = function () {
                if (this.canClick) {
                    l.default.showAd(function () {
                        console.log("餐厅升级,展示广告");
                    }, l.AdTypeEm.upLv);
                    QAudio.play(QAudio.ui_button);
                    QReport.send(6202 + GameDataValue.getLastLv() + "");
                    c.default.open(s.UIID.UIGameOver, {
                        cb: function () {
                            c.default.open(s.UIID.UIGameData);
                        }
                    });
                    c.default.closeUiByUIID(s.UIID.UIGameData);
                    this.closeUI();
                }
            };
            e.prototype._onCloseTouchEnd = function () {
                l.default.hideAd(l.AdTypeEm.implant);
                QAudio.play(QAudio.ui_button);
                this.closeUI();
            };
            e.prototype._onMapBtnTouchEnd = function () {
                QAudio.play(QAudio.ui_button);
                var t = GameDataValue.getLastLv(),
                    e = t % 7;
                c.default.open(s.UIID.UIChangeScenes, {lv: t, lvIndex: e, isPlay: !0});
            };
            return n([u], e);
        })(r.default));
o.default = h;
